clear all
*cd "/Users/michelletorres/Dropbox/3rdYearPaper/MSM_Final/Replication Files/Data"
use "DataStudent82.dta", clear
gen caseID73 = V6
save "DataStudent82.dta", replace

clear all
use "Final_Data_Students_6573.dta", clear

drop _merge
drop if caseID73==.
merge 1:1 caseID73 using "DataStudent82.dta"
keep if _merge==3

drop _merge

** NOTE: I cannot merge ONLY 65 and 82 because they did not provide a matching ID for those waves... infinite sadness.

**** Education: 3= HS + Non-college training, 4=Some College 5=College 6=More than college
gen educ_82 = educ_73
replace educ_82 =5 if V469 == 1 & educ_82==3	
replace educ_82 =5 if V469 == 1 & educ_82==4	
replace educ_82 =6 if V469 == 1 & educ_82==5 & V470>=3

***** Occupation (1= Professional and technical/Self-employed businessmen, managers and officials;
* 2= clerical and sales/Skilled workers; 3= Semi skilled workers/Service workers, 4= unskilled laborers/farm operators, 5 = unemployed)
gen occup_82=.
replace occup_82= . if V484==0
replace occup_82= 1 if V484>=1 & V484<=195
replace occup_82= 1 if V484==196
replace occup_82= 1 if V484>=201 & V484<=245
replace occup_82= 1 if V484==246
replace occup_82= 2 if V484>=260 & V484<=285
replace occup_82= 2 if V484==296 | V484==396
replace occup_82= 2 if V484>=301 & V484<=395
replace occup_82= 2 if V484>=401 & V484<=600
replace occup_82= 2 if V484==596
replace occup_82= 3 if V484>=601 & V484<=695
replace occup_82= 3 if V484>=701 & V484<=715
replace occup_82= 3 if V484==696 | V484==726
replace occup_82= 3 if V484>=740 & V484<=785
replace occup_82= 3 if V484>=821 & V484<=824
replace occup_82= 3 if V484==976 | V484==986
replace occup_82= 4 if V484>=901 & V484<=965
replace occup_82= 4 if V484>=980 & V484<=984
replace occup_82= 4 if V484==796 | V484==846
replace occup_82= 4 if V484>=801 & V484<=802
replace occup_82= . if V484>=999

*** Income
gen income_82 = V602
replace income_82 = V603 if income_82==.
recode income_82 (0=.) (97/99=.)
xtile qinc_82 =income_82, nquantiles(4)

*** Own a house (1=Owns a house, 0=Rent/Other/Weird responses)
gen ownhome_82 = V604
recode ownhome_82 (0=.) (2/7=0)

**************************
*** POLITICAL VARIABLES **
**************************

*** Political interest (1=Most of the time, 2=Some of the time, 3=Only now and then, 4=Hardly at all)
gen polint_82 = V66
recode polint_82 (9=.)

*** Frequency of news (1=Daily, 2=2 times a week, 3=3 or 4 times a month, 4=few times a year/DK Freq, 5=Nothing
gen fnews_82 = V54
recode fnews_82 (9=.) (0=5)

*** Party ID 
* Long (1=Strong Democrat, 2=Weak Democrat, 3=Leaner Democrat, 4=Independent, 5= Leaner Rep, 6=Weak Rep, 7=Strong Rep, 8=Other/Apolitical)
gen pid7_82 = V286 + 1
recode pid7_82 (8/9=8) (10=.)

* Short 
* Version 1: 1=Republican, 3=Neither, 5=Democrat
gen pids3_82 = V283
recode pids3_82 (0=.) (9=3)
* Version 2: (1=Democrat, 2=Neither, 3=Republican, 4=Other/Apolitical)
gen pid3_82 = pid7_82
recode pid3_82 (1/3=1) (5/7=3) (4=2)
replace pid3_82=4 if pid7_82==8

*** Pol Knowledge
gen polknow_82 = V615
recode polknow_82 (0=.)

*** Cosmopolitanism
gen cosmo_82 = V622
recode cosmo_82 (0=.)

*** Efficacy (External)
gen eff_82 = V614
recode eff_82 (0=.)

rename V4 caseID82
rename V611 caseID73_2
drop V1-V3 V5-V319 V321-V340  V342-V610 V612-V631
drop income_82 pids3_82 pid7_82

save "Final_Data_Students_7382.dta", replace

